package Text;

import java.util.Scanner;

public class Text3 {
    public static void main(String[] args) {
        int a=0;
        int b=0;
        Scanner sc=new Scanner(System.in);
        a=sc.nextInt();
        b=sc.nextInt();
        int max=a>b?a:b;
        for(;;){
            int sum=a+b-max;
            int n=max%sum;
            if(n==0){
                System.out.println("最大公因数是"+sum);
                break;
            }
            max=sum;
            sum=n;

        }
    }
}
